// components/bookRankRight/bookRankRight.js
const app = getApp()
// const watch = require('../../utils/watch')
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    rightData: {
      type: Object,
      value: null,
      observer:function(oldValue,newValue){
        // console.log('oldValue---->',oldValue);
        // console.log('newValue---->',newValue);
        // if(newValue){
        //   this.getHeight()
        // }
      }
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    boxHeight: 0,
    listLength: 0,
  },
  attached() {
    // watch.setWatcher(this); // 设置监听器，建议在onLoad下调用
    // setTimeout(() => {
    //   // console.log('详情数据----->', this.properties.rightData.list.length);
    //   this.getHeight()
    // }, 1000)
  },
  /**
   * 组件的方法列表
   */
  methods: {
    getHeight() {
      const query = wx.createSelectorQuery().in(this)
      query.select('.rank_book_item').boundingClientRect((rect) => {
        let len = rect.height * this.properties.rightData.list.length * 2 +30
        console.log(len);
        // 子传父
        app.globalData.lenHeight = len
      }).exec()
    }
  },
 

})